package cn.seaboot.admin.file.service;

import cn.seaboot.admin.file.bean.SysFolder;
import cn.seaboot.admin.file.dao.FolderDao;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * Service
 * 虚拟文件夹 [t_sys_folder]
 *
 * @author Mr.css on 2018-6-20
 */
@Service
public class FolderService {

    @Resource
    private FolderDao folderDao;

    /**
     * 增
     *
     * @return affected rows
     */
    public int addFolder(String pid) {
        SysFolder child = new SysFolder();
        child.setPid(pid);
        return folderDao.insert(child);
    }

    /**
     * 增
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int insert(SysFolder pojo) {
        return folderDao.insert(pojo);
    }

    /**
     * 删
     *
     * @param id id
     * @return affected rows
     */
    public int deleteById(String id) {
        return folderDao.deleteById(id);
    }

    /**
     * 改
     *
     * @param pojo pojo
     * @return affected rows
     */
    public int updateById(SysFolder pojo) {
        return folderDao.updateSampleById(pojo);
    }

    /**
     * 查
     *
     * @param id id
     * @return pojo
     */
    public SysFolder queryById(String id) {
        return folderDao.selectById(id);
    }

    /**
     * 查列表
     *
     * @param params 参数
     * @return list
     */
    public List<Map<String, Object>> queryList(Map<String, Object> params) {
        return folderDao.selectList(params);
    }
}
